/*
 * MessagingServiceImpl.java
 *
 * Created on December 31, 2008, 10:46 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.vacuela.publishmx.services;

import java.util.List;
import org.vacuela.publishmx.context.ServiceContext;
import org.vacuela.publishmx.domains.Message;

/**
 *
 * @author nestor.carrasco
 */
public class MessagingServiceImpl  extends AbstractDaoBasedPublish implements MessagingService{
    
    /** Creates a new instance of MessagingServiceImpl */
    public MessagingServiceImpl() {
    }
    
    public void saveUpdateMessage(ServiceContext context) {
        Message msg = (Message)context.getAttribute("messageDomain");
        this.messageDao.saveUpdate(msg);
        messageDao.scheduleIndMessages(msg);
        messageDao.scheduleMassiveMessages(msg);
    }
    
    public void getMessagesByUserId(ServiceContext context) {
    }
    
    public void getMessageBetween(ServiceContext context) {
    }
    
    public void getMessageList(ServiceContext context) {
    }
    
    public void readNewInputMessages(ServiceContext context){
        List<Message>  inpuMsgList =( List<Message>  )this.messageDao.getNewInputMessages();
        context.setAttribute("inpuMsgList",inpuMsgList);
    }
    
    public void changeStatusOfMessage(ServiceContext context){
        String msgIds = (String)context.getAttribute("msgIds");
        String newStatus = (String)context.getAttribute("newStatus");
        this.messageDao.changeStatus(msgIds,newStatus);
    }
}
